import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './elementui/elementui.js'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/global.css'
import axios from 'axios'
// 对axios进行全局配置
//给vue实例添加一个$http属性 ，
Vue.prototype.$http = axios;
//设置基础url
axios.defaults.baseURL = 'http://127.0.0.1:8890'
//通过axios拦截器，为axios发送每个请求加上token,除了登录请求
axios.interceptors.request.use( req =>{
  req.headers.Authorization = window.sessionStorage.getItem('token');
  //放行
  return req;
})


Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
